/**
 * 
 */
package team7.made;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Team 7
 *
 */
public class Question {

	/**
	 * refers to <statement> method
	 */
	private String questionStatement;
	
	/**
	 * store the <question id=""> id attribute in <question tag.
	 */
	private String id;
	
	/**
	 * store answer choices from <options> xml element
	 */
	private Map<String, String> options = new HashMap<String, String>();
	
	/**
	 * refers to the <answer> xml element.
	 */
	private String correctOption;
	
	/**
	 * @return answer for the question
	 */
	public String getAnswer() {
		String answer = "";
		if(correctOption != null || !"".equals(correctOption)) {
			answer = options.get(correctOption);			
		}
		return answer;
	}
	
	public void setAnswer(String ans) {
		this.correctOption = ans;
	}
	
	/**
	 * method protected as it is not to be accessed by clients.
	 * 
	 * @return map of options.
	 */
	protected Map<String, String> getOptionsMap() {
		return options;
	}
	
	public String getQuestionStatement() {
		return questionStatement;
	}

	public void setQuestionStatement(String questionStatement) {
		this.questionStatement = questionStatement;
	}
	
	public Collection<String> getOptions() {
		return options.values();
	}

	public String getCorrectOption() {
		return correctOption;
	}

	public void setCorrectOption(String correctOption) {
		this.correctOption = correctOption;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
}